Folders Property (Folder Object) 

The Folders property specifies a collection of subfolders within the parent folder. Read-only.

Syntax

objFolder.Folders

Data Type

Object

Example

This example lists all the names of all subfolders of the specified folder:

' fragment from Session_Inbox

    Set objFolder = objSession.Inbox

' from TstDrv_Util_ListFolders

   If 2 = objFolder.Class Then  ' verify Folder object

        x = Util_ListFolders(objFolder)  ' use current global folder

   End If

 

' complete function for Util_ListFolders

Function Util_ListFolders(objParentFolder As Object)

Dim objFoldersColl As Object ' the child Folders collection

Dim objOneSubfolder As Object 'a single Folder object

    ' set up error handler here

    If Not objParentFolder Is Nothing Then

        MsgBox ("Folder name = " & objParentFolder.Name)

        Set objFoldersColl = objParentFolder.Folders

        If Not objFoldersColl Is Nothing Then ' loop through all

            Set objOneSubfolder = objFoldersColl.GetFirst

            While Not objOneSubfolder Is Nothing

                x = Util_ListFolders(objOneSubfolder)

                Set objOneSubfolder = objFoldersColl.GetNext

            Wend

        End If

    End If

    Exit Function

    ' error handler here

End Function

 

See Also

Folders Collection